package com.yanggu.mapreduce.groupingcomparator;

import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

/**
 * @version V1.0
 * @author: YangGu
 * @date: 2020/2/7 16:43
 * @description:
 */
public class OrderBeanGroupingComparator extends WritableComparator {

    protected OrderBeanGroupingComparator() {
        super(OrderBean.class, true);
    }


    @Override
    public int compare(WritableComparable a, WritableComparable b) {
        OrderBean orderBean1 = (OrderBean) a;
        OrderBean orderBean2 = (OrderBean) b;

        return orderBean1.getId() - orderBean2.getId();
    }
}
